package edu.yuhf.vo;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@EqualsAndHashCode
public class Person extends Base implements Comparable<Person>{
    private int id;
    private String name;

    public int hashCode(){
        return id*21+name.hashCode()*13;
    }

    public Person(int id){
        this.id = id;
    }

    public void show(){
        super.show();
        System.out.println("Person...");
    }

    @Override
    public void eat() {
        System.out.println("吃熟食");
    }

    @Override
    public int compareTo(Person o) {
        if(this.id>o.getId()){
            return 1;
        }else if(this.id<o.getId()){
            return -1;
        }else{
            return 0;
        }

    }
}
